package com.example.composableexample.systembar

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.consumedWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController


@Composable
fun SystemBarSimple(navController: NavController) {

    Button(
        onClick = {
            navController.navigate("detail")
        }) {
        Text(text = "跳转detail")
    }
}

@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
@Composable
fun SystemBarDetail(navController: NavController) {
    Column(modifier = Modifier.fillMaxSize().background(Color.Red)) {
        TopAppBar(
            title = { Text(text = "标题") },
            windowInsets = WindowInsets(top = 24)
        )
        Button(
            onClick = {
                navController.navigate("home")
            }
        ) {
            Text(text = "跳转home")
        }
    }
}